package com.yyk.dzvisit.core.base;

import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import com.yyk.dzvisit.core.filter.YykRequestFilter;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;

/**
 * create by zhouc 2019/11/07
 */
@MapperScan(basePackages = "com.yyk.*.dmr.*.mapper")
public class BaseApplication {

    /**
     * 分页插件
     */
    @Bean
    public PaginationInterceptor paginationInterceptor() {
        return new PaginationInterceptor();
    }

    @Bean
    public FilterRegistrationBean testFilterRegistration() {
        FilterRegistrationBean registration = new FilterRegistrationBean();
        registration.setFilter(new YykRequestFilter());
        registration.addUrlPatterns("/*");
        registration.setName("yykRequestFilter");
        registration.setOrder(-100);
        return registration;
    }
}
